package alpha;


/**
 * Write a description of class OperandoComplexo here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class OperandoComplexo
{
    private Operando real;
    private Operando imaginario;
    private Operando atual;
    
    public OperandoComplexo()
    {
        real = new Operando();
        real.setBaseDecimal();
        imaginario = new Operando();
        imaginario.setBaseDecimal();
        atual = real;
    }
    
    public OperandoComplexo(OperandoComplexo acumulador)
    {
        real = new Operando();
        real.setBaseDecimal();
        imaginario = new Operando();
        imaginario.setBaseDecimal();
        atual = real;
        real.setEstado(acumulador.imaginario);
    }
   
    public final String entraUm()
    {
        atual.entraUm();
        return toString();
    }
    
    public final void entraI()
    {
        atual = imaginario;
    }
    
    public final void soma(OperandoComplexo x)
    {
        real.soma(x.real);
        imaginario.soma(x.imaginario);
    }
    
    public final String toString()
    {
        String img = imaginario.toString();
        
        if ("0".equals(img) || "0b0".equals(img) || "0x0".equals(img))
            img = "";
        else
            img = "I" + img;
     
        return real.toString() + img;
    }
    
    public final void modoHex()
    {
        real.setBaseHexa();
        imaginario.setBaseHexa();
    }

    public final void modoBin()
    {
        real.setBaseBinario();
        imaginario.setBaseBinario();
    }

    public final void modoDec()
    {
        real.setBaseDecimal();
        imaginario.setBaseDecimal();
    }
 
}
